<?php

/**
 * BuddyPress - Members Directory
 */

	get_header( 'buddypress' );

	// GET CUSTOM SIDEBAR
	$sidebar = get_post_meta($post->ID, 'sidebar_value', true);

	do_action( 'bp_before_directory_members_page' ); ?>

		<div id="content">

			<div class="padder contentbox <?php if ($sidebar == 'No sidebar') : echo'wfull'; else : echo'w720'; endif; ?>">
	
				<?php do_action( 'bp_before_directory_members' ); ?>
		
				<form action="" method="post" id="members-directory-form" class="dir-form">
		
					<h3><?php _e( 'Members Directory', 'buddypress' ); ?></h3>
		
					<?php do_action( 'bp_before_directory_members_content' ); ?>
		
					<div id="members-dir-search" class="dir-search" role="search">
		
						<?php bp_directory_members_search_form(); ?>
		
					</div><!-- #members-dir-search -->


					<div id="item-nav">

						<div class="item-list-tabs" role="navigation">
	
							<ul>
	
								<li class="selected" id="members-all">
	
									<a href="<?php echo trailingslashit( bp_get_root_domain() . '/' . bp_get_members_root_slug() ); ?>"><?php printf( __( 'All Members <span>%s</span>', 'buddypress' ), bp_get_total_member_count() ); ?></a>
	
								</li>
			
								<?php
	
									if ( is_user_logged_in() && bp_is_active( 'friends' ) && bp_get_total_friend_count( bp_loggedin_user_id() ) ) : ?>
	
										<li id="members-personal">
	
											<a href="<?php echo bp_loggedin_user_domain() . bp_get_friends_slug() . '/my-friends/' ?>"><?php printf( __( 'My Friends <span>%s</span>', 'buddypress' ), bp_get_total_friend_count( bp_loggedin_user_id() ) ); ?></a>
	
										</li>
	
										<?php
	
									endif;
	
									do_action( 'bp_members_directory_member_types' );
	
								?>
			
							</ul>
	
						</div><!-- .item-list-tabs -->

					</div>


					<div class="item-list-tabs" id="subnav" role="navigation">

						<ul>
		
							<?php do_action( 'bp_members_directory_member_sub_types' ); ?>
		
							<li id="members-order-select" class="last filter">
		
								<label for="members-order-by"><?php _e( 'Order By:', 'buddypress' ); ?></label>

								<select id="members-order-by">

									<option value="active"><?php _e( 'Last Active', 'buddypress' ); ?></option>
									<option value="newest"><?php _e( 'Newest Registered', 'buddypress' ); ?></option>
		
									<?php

										if ( bp_is_active( 'xprofile' ) ) : ?>
		
											<option value="alphabetical"><?php _e( 'Alphabetical', 'buddypress' ); ?></option>
			
											<?php

										endif;

										do_action( 'bp_members_directory_order_options' );

									?>
		
								</select>

							</li>

						</ul>

					</div>
		
					<div id="members-dir-list" class="members dir-list">
		
						<?php locate_template( array( 'members/members-loop.php' ), true ); ?>
		
					</div><!-- #members-dir-list -->
		
					<?php

						do_action( 'bp_directory_members_content' );

						wp_nonce_field( 'directory_members', '_wpnonce-member-filter' );

						do_action( 'bp_after_directory_members_content' );

					?>
		
				</form><!-- #members-directory-form -->
		
				<?php
		
					do_action( 'bp_after_directory_members' );

					do_action( 'bp_after_directory_members_page' );
		
				?>
	
			</div><!-- end padder contentbox w620 -->

				<?php
					// SIDEBAR
					include(TEMPLATEPATH.'/inc/sidebar_buddy.php');
				?>

			<div class="clear"><!-- --></div>
	
		</div><!-- #content -->

	</div>

<?php get_footer( 'buddypress' ); ?>